package com.jian.socks5.udp;

import io.netty.buffer.ByteBuf;
import io.netty.handler.codec.socksx.v5.Socks5AddressType;

import java.net.InetSocketAddress;

/***
 * Socks5 UDP报文
 * @author Jian
 * @date 2021.06.21
 */
public class DefaultSocks5UDPPacket {
    /***
     *
     */
    private InetSocketAddress recipient;
    /***
     * 发送者
     */
    private InetSocketAddress sender;

    private short RSV; // RSV

    private byte FRAG; // FRAG

    private Socks5AddressType socks5AddressType;

    private String dstAddr;

    private int dstPort;

    private ByteBuf data;

    public DefaultSocks5UDPPacket(InetSocketAddress recipient,InetSocketAddress sender,short RSV, byte FRAG, Socks5AddressType socks5AddressType, String dstAddr, int dstPort, ByteBuf data) {
        this.recipient = recipient;
        this.sender = sender;
        this.RSV = RSV;
        this.FRAG = FRAG;
        this.socks5AddressType = socks5AddressType;
        this.dstAddr = dstAddr;
        this.dstPort = dstPort;
        this.data = data;
    }

    public DefaultSocks5UDPPacket(InetSocketAddress recipient,short RSV, byte FRAG, Socks5AddressType socks5AddressType, String dstAddr, int dstPort, ByteBuf data) {
        this(recipient,null,RSV, FRAG, socks5AddressType, dstAddr, dstPort, data);
    }

    public DefaultSocks5UDPPacket(InetSocketAddress recipient,InetSocketAddress sender,Socks5AddressType socks5AddressType, String dstAddr, int dstPort, ByteBuf data) {
        this(recipient,sender,(short)0,(byte)0,socks5AddressType, dstAddr, dstPort, data);
    }

    public DefaultSocks5UDPPacket(InetSocketAddress recipient,Socks5AddressType socks5AddressType, String dstAddr, int dstPort, ByteBuf data) {
        this(recipient,null,(short)0,(byte)0,socks5AddressType, dstAddr, dstPort, data);
    }

    public short getRSV() {
        return RSV;
    }

    public byte getFRAG() {
        return FRAG;
    }

    public Socks5AddressType getSocks5AddressType() {
        return socks5AddressType;
    }

    public String getDstAddr() {
        return dstAddr;
    }

    public int getDstPort() {
        return dstPort;
    }

    public ByteBuf getData() {
        return data;
    }

    public InetSocketAddress getRecipient() {
        return recipient;
    }

    public InetSocketAddress getSender() {
        return sender;
    }
}
